Me_Sucker = 0
Me_Exploiter = 0
Me_Cooperate = 0
Me_Lazy = 0
last_hunters = 0

def hunt_choices(round_number,current_food,current_reputation,m,player_reputations):
	
	average_rep = sum(player_reputations) / len(player_reputations)
	max_rep_not_one = max([x for x in player_reputations if x != 1])
	My_Rep_Number = len([x for x in player_reputations if x == current_reputation])
	h_score = (Me_Sucker * -3 + Me_Cooperate * 0)
	potential_score = (Me_Cooperate + Me_Sucker) * -2
	
	global Me_Sucker
	global Me_Exploiter
	global Me_Cooperate
	global Me_Lazy
	global last_hunters
	
	hunt_decisions = []
	
	for reputation in player_reputations:
		if len(player_reputations) == 1:  #What to do if there are only two players left:
			my_play = 's' ##Never 'h' as the only way to change the difference in food between us (to my benefit) is 's'
		elif My_Rep_Number >= 1: ##What to do if there is someone else with my reputation number
			if reputation == current_reputation: ##If someone has my reputation, they're doing the same thing I'm doing so will probably cooperate
				my_play = 'h' ##This should make me cooperate in round 1, which will signal to others I might cooperate
			else: my_play = 's'			  
		elif reputation == 0 or reputation == 1 or current_reputation >= max_rep_not_one:
			#If they always slack no matter what I do, I want to slack
			#If they always hunt no matter what I do, I want to slack
			#If I happen to be the most cooperative player left... they'll assume I'll cooperate and I probably have some reputation to give, so I'll slack
			my_play = 's'
		elif last_hunters == 0: ##If no one else is hunting, I don't want to be
			my_play = 's'
		elif h_score > potential_score:
			##Did I do better trying to cooperate last round? If not I should give up, but if I did do better, try again
			if current_reputation > average_rep: ##If I'm above average, maybe they'll cooperate with me
				if reputation >= current_reputation:
					my_play = 'h' ##Cooperate if their reputation is greater than mine
				elif reputation > average_rep and round_number < 25:
					my_play = 'h' ##Be a little more cooperative in early rounds
				else: my_play = 's'
			else: my_play = 's'
		else: my_play = 's' ##Most of the time, I want to be a freeloader
		hunt_decisions.append(my_play)
				
	return hunt_decisions
	

def hunt_outcomes(food_earnings):
	##To see how I've been doing
	global Me_Sucker
	global Me_Exploiter
	global Me_Cooperate
	global Me_Lazy
	Me_Sucker = len([x for x in food_earnings if x==-3])
	Me_Exploiter = len([x for x in food_earnings if x== 1])
	Me_Cooperate = len([x for x in food_earnings if x== 0])
	Me_Lazy = len([x for x in food_earnings if x== -2])
	
	##print("My Hunt Score:",  (Me_Sucker * -3 + Me_Cooperate * 0))
	##print("I could Have gotten by slacking: ", (Me_Cooperate + Me_Sucker) * -2)
	##input("Press Enter to continue...")
	
	pass
	

def round_end(award, m, number_hunters):
	##To see if anyone else is hunting
	global last_hunters
	last_hunters = number_hunters
	
	pass 